<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

<<<<<<< HEAD
/**
 * @property array|string title
 * @property array|string body
 * @property array|string user_id
 * @property array|string column_id
 * @property int view
 * @property int like
 * @property int hot
 * @property int status
 * @property null img_path
 * @property mixed id
 */
=======
>>>>>>> 3cbfde5c21633bb47be419577bca65cd8c0581b5
class Post extends Model
{
    //关联表
    protected $table = 'posts';
    //主键
    public $primaryKey = 'id';
    //设置timesatmps为开启
    public $timestamps = true;

    public function user()
    {
        return $this->belongsTo('App\User');
    }

    public function messages()
    {
        return $this->hasMany('App\Message');
    }

    public function loop()
    {
        return $this->hasOne('App\Loop');
    }

    public function tags()
    {
        return $this->belongsToMany('App\Tag','post_tags');
    }

    public function column()
    {
        return $this->belongsTo('App\Column');
    }
}
